/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package AdminOperations;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author ABDELMOHSEN
 */
public class AdminAddAdv {
    public void addAdv(String url){
        File f=new File("./ForumConfig2.txt");
        try {
            
            DataInputStream din = new DataInputStream(new FileInputStream(f));
            DataOutputStream dOut = new DataOutputStream(new FileOutputStream(f));
            dOut.writeUTF(url);
            dOut.close();
        } catch (IOException ex) {
            Logger.getLogger(AdminAddAdv.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    public String getAdv(){
        String url="http://jets.iti.gov.eg/JETS/HomePage.jsp";
        File f=new File("./ForumConfig2.txt");
        try {
            
            DataInputStream din = new DataInputStream(new FileInputStream(f));
            url=din.readUTF();
        } catch (Exception ex) {
            addAdv(url);
        }
        return url;
    }
}
